public class Position
{
	public Position(int x, int y)
	{
		this.x = x;
		this.y = y;
	}
	public int x;
	public int y;
	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + x;
		result = prime * result + y;
		return result;
	}
	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Position other = (Position) obj;
		if (x != other.x)
			return false;
		if (y != other.y)
			return false;
		return true;
	}
	public Position plus(Position other)
	{
		return new Position(x + other.x, y + other.y);
	}
	public Position add(Position other)
	{
		x += other.x;
		y += other.y;
		return this;
	}
	public int getManhattanDistanceTo(Position other)
	{
		return Math.abs(other.x - x) + Math.abs(other.y - y);
	}
	@Override
	public String toString() {
		return "[" + x + ", " + y + "]";
	}
	public Position setLerp(Position from, Position to, double amount)
	{
		x = (int)(from.x * (1 - amount) + to.x * amount);
		y = (int)(from.y * (1 - amount) + to.y * amount);
		return this;
	}
}
